<!DOCTYPE html> <title>Prevent Overflow Visual Test</title>

<style>
  @import '/reset.css';
  #scroll {
    position: relative;
    overflow: scroll;
    width: 584px;
    height: 584px;
    background-color: grey;
  }

  #scroll::before {
    content: 'before';
    display: block;
    height: 2000px;
    width: 1px;
  }

  #scroll::after {
    content: 'after';
    display: block;
    height: 2000px;
    width: 1px;
  }

  #reference {
    width: 200px;
    height: 200px;
    background-color: red;
    box-shadow: inset 0 0 0 1px black;
    position: relative;
    left: 200px;
  }

  #popper {
    width: 100px;
    height: 300px;
    background-color: rgba(200, 0, 255, 0.5);
    box-shadow: inset 0 0 0 1px black;
  }

  #arrow {
    width: 20px;
    height: 20px;
    background-color: yellow;
  }
</style>

<div id="scroll">
  <div id="reference">Reference Box</div>
  <div id="popper">Popper Box</div>
</div>

<script type="module">
  import { createPopper } from '../../dist/popper.js';
  const reference = document.querySelector('#reference');
  const popper = document.querySelector('#popper');

  window.instance = createPopper(reference, popper, {
    placement: 'top',
    modifiers: [
      {
        name: 'flip',
        enabled: false,
      },
      {
        name: 'offset',
        options: {
          offset: [25, 25],
        },
      },
      {
        name: 'preventOverflow',
        options: {
          altAxis: true,
          tether: true,
        },
      },
    ],
  });
</script>
